<?php

class School extends AppModel {
	var $name= 'School';
	
	//ACL this is a crontrolled object ACO
	var $actsAs = array('Acl' => array('type' => 'controlled'));
	
	function parentNode() {
		if (!$this->id && empty($this->data)) {
			return null;
		}
		if (isset($this->data['School']['application_id'])) {
			$appId = $this->data['School']['application_id'];
		} else {
			$appId = $this->field('application_id');
		}
		if (!$appId) {
			return null;
		} else {
			return array('Application' => array('id' => $appId));
		}
	}
	
	
  var $validate = array(
	  'schoolname' => array(
		  'notempty' => array(
			  'rule' => array('notempty'),
			  'message' => 'A schoolname is required.'
			)
		),
		 'major_minor' => array(
		  'notempty' => array(
			  'rule' => array('notempty'),
			  'message' => 'This field is required.'
			)
		)
	); 
	
/**
* START ASSOCIATION INFORMATION
******************************************************************************
*/ 	
	var $belongsTo = array(
		'Application' => array(
			'className' => 'Application',
			'foreignKey' => 'application_id'
		)
	); //end belongsTo array.
												
}

?>
